<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"> 

<h:head></h:head> 
<body>

	<h:form>
	<div style="width: 50%; margin-left: 25%;"> 			
		<p:dataTable id="tableEmp" value="#{loginBean.usuarioLogado.empresas}" var="_empresa" selection="#{loginBean.empresaSessao}" selectionMode="single" rowKey="#{_empresa.id}">
			<p:ajax event="rowSelect" listener="#{loginBean.paginaPrincipal()}" resetValues="true" update="@form" />
			<p:column headerText="CNPJ">
				<h:outputText value="#{_empresa.cpfCnpj}" />
			</p:column>
			<p:column headerText="Razão Social">
				<h:outputText value="#{_empresa.razao}" />
			</p:column>
		</p:dataTable>
		</div>				
	</h:form>
	
</body> 
</html>
